import request from '@/utils/request'
import { remoteRequest } from '@/utils/remote'

// 查询列表
export function listEarthquake(id) {
  return request({
    url: '/fxfzaqbz/data/getEarthEntity?id=' + id,
    method: 'get',
  })
}

// 查询列表
export function listEarthquakes(id) {
  return request({
    url: '/fxfzaqbz/data/getEarthEntityTwo?id=' + id,
    method: 'get',
  })
}

// 查询详细
export function getEarthquake(id) {
  return request({
    url: '/fxfzaqbz/data/getRiskAssessmentById?id=' + id,
    method: 'get'
  })
}

// 上传
export function uploadEarthquake(data) {
  return request({
    url: '/fxfzaqbz/data/saveRiskAssessment',
    method: 'post',
    data: data
  })
}

// 上传图片
export function uploadEarthquakePic(data) {
  return request({
    url: '/attachment/uploadFile',
    method: 'post',
    data: data
  })
}

// 修改
export function updateEarthquake(data) {
  return request({
    url: '/fxfzaqbz/data/updateRiskAssessment',
    method: 'post',
    data: data
  })
}

// 删除
export function delEarthquake(id) {
  return request({
    url: '/fxfzaqbz/data/deleteRiskAssessment?id=' + id,
    method: 'post'
  })
}

// 标题是否重复
export function titleCheck(data) {
  return remoteRequest('titleCheck', data, () => {
    return request({
      url: '/fxfzaqbz/data/riskAssessmentIfRepetition',
      method: 'post',
      data: data
    })
  })
}

// 提交最终成果
export function firstSubmitDisasterAss(id) {
  return request({
    url: '/fxfzaqbz/data/firstSubmitRiskAssessment?id=' + id,
    method: 'post',
  })
}

// 提交
export function secondSubmitDisasterAss(ids) {
  return request({
    url: '/fxfzaqbz/data/secondSubmitRiskAssessment/' + ids,
    method: 'post',
  })
}

// 移除数据
export function removeDisasterAss(id) {
  return request({
    url: '/fxfzaqbz/data/removeRiskAssessmentDisasterAss?id=' + id,
    method: 'post',
  })
}


// 编辑描述
export function updataDescribe(data) {
  return request({
    url: '/fxfzaqbz/data/addRiskAssessmentDisaster',
    method: 'post',
    data: data
  })
}

// 查重
export function whatIsThisNumber(data) {
  return request({
    url: '/fxfzaqbz/data/whatIsThisNumber',
    method: 'post',
    data: data
  })
}

// 覆盖
export function coverRiskAssessment(data) {
  return request({
    url: '/fxfzaqbz/data/coverRiskAssessment',
    method: 'post',
    data: data
  })
}

